<!doctype html>



  


<html class="theme-next pisces use-motion" lang="zh-Hans">
<head>
  <meta charset="UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/>









<meta http-equiv="Cache-Control" content="no-transform" />
<meta http-equiv="Cache-Control" content="no-siteapp" />















  
  
  <link href="/lib/fancybox/source/jquery.fancybox.css?v=2.1.5" rel="stylesheet" type="text/css" />




  
  
  
  

  
    
    
  

  

  

  

  

  
    
    
    <link href="//fonts.googleapis.com/css?family=Lato:300,300italic,400,400italic,700,700italic&subset=latin,latin-ext" rel="stylesheet" type="text/css">
  






<link href="/lib/font-awesome/css/font-awesome.min.css?v=4.6.2" rel="stylesheet" type="text/css" />

<link href="/css/main.css?v=5.1.1" rel="stylesheet" type="text/css" />


  <meta name="keywords" content="Hexo, NexT" />








  <link rel="shortcut icon" type="image/x-icon" href="/favicon.ico?v=5.1.1" />






<meta name="description" content="什么是rocketmq:RocketMQ: 一个分布式,队列模型的消息中间件1.能够保证顺序的消息顺序2.丰富的消息拉取模式3.高效水平扩展能力,高可用4.实时消息订阅机制5.亿级消息堆积能力,消息堆积后,写入低延迟6.消息的刷盘策略:同步双写、异步复制 Consumer:1.消费过程要做到幂等（即消费端去重）2.尽量使用批量方式消费方式，3.可以很大程度上提高消费吞吐量 为什么学习rocketm">
<meta property="og:type" content="article">
<meta property="og:title" content="初学RocketMQ">
<meta property="og:url" content="http://yoursite.com/2017/07/14/rocketmq/初学RocketMQ/index.html">
<meta property="og:site_name" content="Tissan">
<meta property="og:description" content="什么是rocketmq:RocketMQ: 一个分布式,队列模型的消息中间件1.能够保证顺序的消息顺序2.丰富的消息拉取模式3.高效水平扩展能力,高可用4.实时消息订阅机制5.亿级消息堆积能力,消息堆积后,写入低延迟6.消息的刷盘策略:同步双写、异步复制 Consumer:1.消费过程要做到幂等（即消费端去重）2.尽量使用批量方式消费方式，3.可以很大程度上提高消费吞吐量 为什么学习rocketm">
<meta property="og:image" content="http://yoursite.com/uploads/rocketmq/rocketmq_overview.png">
<meta property="og:image" content="http://yoursite.com/uploads/rocketmq/rocketmq_server.png">
<meta property="og:updated_time" content="2017-12-17T08:24:47.000Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="初学RocketMQ">
<meta name="twitter:description" content="什么是rocketmq:RocketMQ: 一个分布式,队列模型的消息中间件1.能够保证顺序的消息顺序2.丰富的消息拉取模式3.高效水平扩展能力,高可用4.实时消息订阅机制5.亿级消息堆积能力,消息堆积后,写入低延迟6.消息的刷盘策略:同步双写、异步复制 Consumer:1.消费过程要做到幂等（即消费端去重）2.尽量使用批量方式消费方式，3.可以很大程度上提高消费吞吐量 为什么学习rocketm">
<meta name="twitter:image" content="http://yoursite.com/uploads/rocketmq/rocketmq_overview.png">



<script type="text/javascript" id="hexo.configurations">
  var NexT = window.NexT || {};
  var CONFIG = {
    root: '/',
    scheme: 'Pisces',
    sidebar: {"position":"left","display":"post","offset":12,"offset_float":0,"b2t":false,"scrollpercent":false},
    fancybox: true,
    motion: true,
    duoshuo: {
      userId: 'undefined',
      author: 'Java程序员'
    },
    algolia: {
      applicationID: '',
      apiKey: '',
      indexName: '',
      hits: {"per_page":10},
      labels: {"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}
    }
  };
</script>



  <link rel="canonical" href="http://yoursite.com/2017/07/14/rocketmq/初学RocketMQ/"/>





  <title>初学RocketMQ | Tissan</title>
  














</head>

<body itemscope itemtype="http://schema.org/WebPage" lang="zh-Hans">

  
  
    
  

  <div class="container sidebar-position-left page-post-detail ">
    <div class="headband"></div>

    <header id="header" class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-wrapper">
  <div class="site-meta ">
    

    <div class="custom-logo-site-title">
      <a href="/"  class="brand" rel="start">
        <span class="logo-line-before"><i></i></span>
        <span class="site-title">Tissan</span>
        <span class="logo-line-after"><i></i></span>
      </a>
    </div>
      
        <p class="site-subtitle"></p>
      
  </div>

  <div class="site-nav-toggle">
    <button>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
    </button>
  </div>
</div>

<nav class="site-nav">
  

  
    <ul id="menu" class="menu">
      
        
        <li class="menu-item menu-item-home">
          <a href="/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-home"></i> <br />
            
            首页
          </a>
        </li>
      
        
        <li class="menu-item menu-item-categories">
          <a href="/categories/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-th"></i> <br />
            
            分类
          </a>
        </li>
      
        
        <li class="menu-item menu-item-archives">
          <a href="/archives/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-archive"></i> <br />
            
            归档
          </a>
        </li>
      
        
        <li class="menu-item menu-item-tags">
          <a href="/tags" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-tags"></i> <br />
            
            标签
          </a>
        </li>
      
        
        <li class="menu-item menu-item-about">
          <a href="/about" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-user"></i> <br />
            
            关于
          </a>
        </li>
      

      
    </ul>
  

  
</nav>



 </div>
    </header>

    <main id="main" class="main">
      <div class="main-inner">
        <div class="content-wrap">
          <div id="content" class="content">
            

  <div id="posts" class="posts-expand">
    

  

  
  
  

  <article class="post post-type-normal " itemscope itemtype="http://schema.org/Article">
    <link itemprop="mainEntityOfPage" href="http://yoursite.com/2017/07/14/rocketmq/初学RocketMQ/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="name" content="罗天翔">
      <meta itemprop="description" content="">
      <meta itemprop="image" content="/uploads/avatar.jpg">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="Tissan">
    </span>

    
      <header class="post-header">

        
        
          <h1 class="post-title" itemprop="name headline">初学RocketMQ</h1>
        

        <div class="post-meta">
          <span class="post-time">
            
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              
                <span class="post-meta-item-text">发表于</span>
              
              <time title="创建于" itemprop="dateCreated datePublished" datetime="2017-07-14T21:12:09+08:00">
                2017-07-14
              </time>
            

            

            
          </span>

          
            <span class="post-category" >
            
              <span class="post-meta-divider">|</span>
            
              <span class="post-meta-item-icon">
                <i class="fa fa-folder-o"></i>
              </span>
              
                <span class="post-meta-item-text">分类于</span>
              
              
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
                  <a href="/categories/RocketMQ/" itemprop="url" rel="index">
                    <span itemprop="name">RocketMQ</span>
                  </a>
                </span>

                
                
              
            </span>
          

          
            
              <span class="post-comments-count">
              <span class="post-meta-divider">|</span>
              <span class="post-meta-item-icon">
                <i class="fa fa-comment-o"></i>
              </span>
              
                <a href="/2017/07/14/rocketmq/初学RocketMQ/#SOHUCS" itemprop="discussionUrl">
                  <span id="changyan_count_unit" class="post-comments-count hc-comment-count" data-xid="2017/07/14/rocketmq/初学RocketMQ/" itemprop="commentsCount"></span>
                </a>
              
            
          

          
          

          

          

          

        </div>
      </header>
    

    <div class="post-body" itemprop="articleBody">

      
      

      
        <h3 id="什么是rocketmq"><a href="#什么是rocketmq" class="headerlink" title="什么是rocketmq:"></a>什么是rocketmq:</h3><p>RocketMQ: 一个分布式,队列模型的消息中间件<br>1.能够保证顺序的消息顺序<br>2.丰富的消息拉取模式<br>3.高效水平扩展能力,高可用<br>4.实时消息订阅机制<br>5.亿级消息堆积能力,消息堆积后,写入低延迟<br>6.消息的刷盘策略:同步双写、异步复制</p>
<h4 id="Consumer"><a href="#Consumer" class="headerlink" title="Consumer:"></a>Consumer:</h4><p>1.消费过程要做到幂等（即消费端去重）<br>2.尽量使用批量方式消费方式，<br>3.可以很大程度上提高消费吞吐量</p>
<h3 id="为什么学习rocketmq"><a href="#为什么学习rocketmq" class="headerlink" title="为什么学习rocketmq:"></a>为什么学习rocketmq:</h3><p>公司的项目与项目之间通信的需要:<br>1.系统庞大应用与应用之间的通信复杂<br>为什么使用rocketmq而不使用dubbo这类rpc框架呢?<br>1.rocketmq是异步的解耦性优于dubbo<br>2.rocketmq能够将消息持久化(防止网络问题操作失败,可以再次发送消息)</p>
<h3 id="大体结构"><a href="#大体结构" class="headerlink" title="大体结构:"></a>大体结构:</h3><p>1.Producer(生产消息):Producer 与 NameServer 集群中的其中一个节点(随机选择)建立长连接<br>2.NameServer(监控broker)：不用zk是因为nameserver只用实现一个简单的注册中心，producer随机与一个nameserver长连接，获取所有broker的ip，假如有一台nameserver挂了，producer链接另一个nameserver，nameserver不用zk那样挂了会有leader选举过程<br>3.Broker(存储消息):消息分布在各个broker上 ，假如broker的master挂了，nameserver用心跳检查broker是否正常，如果不正常，那么将broker的slave的ip获取到，producer会向slave的ip发送消息<br>4.Consumer(消费消息):Push Consumer、Pull Consumer<br>5.MessageQueue:RocketMQ的消息都是持久化的,队列中每个存储单元都是定长,访问其中存储单元的Offset来访问,64位(MessageQueue是一个长度无限的数组 offset是下标)</p>
<h3 id="基本概念"><a href="#基本概念" class="headerlink" title="基本概念:"></a>基本概念:</h3><p>1.topic:举个栗子(交易信息类,订单信息类)<br>2.tag:比如交易创建,交易完成<br>3.queue:指定broker,producer根据长轮询发送出去<br>Broker部署相对复杂，Broker分为Master与Slave，一个Master可以对应多个Slave，但是一个Slave只能对应一个Master，Master与Slave的对应关系通过指定相同的BrokerName，不同的BrokerId来定义，BrokerId=0表示Master，非0表示Slave。Master也可以部署多个。每个Broker与Name Server集群中的所有节点建立长连接，定时注册Topic信息到所有Name Server。<br>Producer与Name Server集群中的其中一个节点（随机选择）建立长连接，定期从Name Server取Topic路由信息，并向提供Topic 服务的Master建立长连接，且定时向Master发送心跳。Producer 完全无状态，可集群部署。<br>Consumer与Name Server集群中的其中一个节点（随机选择）建立长连接，定期从Name Server取Topic 路由信息，并向提供Topic服务的Master、Slave建立长连接，且定时向Master、Slave发送心跳。Consumer既可以从Master订阅消息，也可以从Slave订阅消息，订阅规则由Broker配置决定。</p>
<h3 id="RocketMQ构成"><a href="#RocketMQ构成" class="headerlink" title="RocketMQ构成"></a>RocketMQ构成</h3><p><img src="/uploads/rocketmq/rocketmq_overview.png" alt="结果"></p>
<h3 id="RocketMQ物理部署结构"><a href="#RocketMQ物理部署结构" class="headerlink" title="RocketMQ物理部署结构"></a>RocketMQ物理部署结构</h3><p><img src="/uploads/rocketmq/rocketmq_server.png" alt="结果"></p>
<h4 id="如何解决消息的顺序和重复消费"><a href="#如何解决消息的顺序和重复消费" class="headerlink" title="如何解决消息的顺序和重复消费"></a>如何解决消息的顺序和重复消费</h4><p><em>1.顺序消费</em>:<br>1)同一个订单hash放到同一个队列里(自己业务处理)<br>如果:重复发送消息<br><em>2.重复消费</em>:自己来保证<br>1)保持幂等性,不管来多少重复消息,结果还是一样的<br>2)将已经处理的消息id储存起来,这样能保证不重复消费</p>
<h3 id="rocketmq如何解决事务问题"><a href="#rocketmq如何解决事务问题" class="headerlink" title="rocketmq如何解决事务问题"></a>rocketmq如何解决事务问题</h3><p><code>事务消息</code><br>分布式事务消息痛点:A-&gt;B转账,锁定A账户,A减10,锁定B账户,B加10,解锁B:非常慢<br>事务:转账的事务拆分成两个小事务:<br>1)发送prepare消息,拿到消息的地址<br>2)执行本地事务<br>3)发送确认消息修改消息状态,根据第一阶段的地址(如果失败就执行5)<br>4)根据确认消息返回找到prepare消息,更新消息状态<br>5)broker会检查信息,如果信息依旧是prepare状态,producer会调用checkTransactionState来检查消息接受者执行状态(消息id)</p>
<h3 id="producer如何发送消息"><a href="#producer如何发送消息" class="headerlink" title="producer如何发送消息"></a>producer如何发送消息</h3><p><code>producer如何发送消息</code><br>1)轮训topic下队列实现负载均衡:消息发送失败,自动重试</p>
<h3 id="消息如何存储"><a href="#消息如何存储" class="headerlink" title="消息如何存储"></a>消息如何存储</h3><p><code>ConsumeLog</code>:消息的逻辑队列<br><code>CommitLog</code>:消息实际存储的物理文件CommitLog</p>
<blockquote>
<p>消息存储会根据key经过hash后找到具体的slot,获取消息会根据时间来查找</p>
</blockquote>
<h3 id="RocketMQ-专业术语"><a href="#RocketMQ-专业术语" class="headerlink" title="RocketMQ 专业术语"></a>RocketMQ 专业术语</h3><p><code>队列</code><br>1.重试队列:(GroupName分队列)如果消息失败了,将发往重试队列中<br>2.死信队列:(GroupName分队列)如果Consumer消费消息在指定次数后仍失败就发往死信队列<br><code>消费模式</code><br>1.广播消费:一个消息能被一个ConsumerGroup中所有的Consumer消费一遍<br>2.集群消费:Consumer分摊消息 一个topic有9条消息 3个Consumer每个消费3个消息<br>3.顺序消息:Producer单线程顺序发送,且发送到同一个队列,这样就能保证Consumer就可以按照Producer顺序消费<br>4.普通顺序消息:正常情况可以保证顺序完全有序 如果Broker重启 队列总数发生变化哈希取模定位的队列会发生变化 (Producer分发消息是队列数,产生短暂消息顺序不一致)<br>5.严格顺序消息:牺牲分布式failover特性(fail跳过)只要有一个Server不可用 整个集群不可用 但是使用了同步双写模式(主从切换)</p>

      
    </div>

    <div>
      
        

      
    </div>

    <div>
      
        
  <div style="padding: 10px 0; margin: 20px auto; width: 90%; text-align: center;">
    <div>坚持原创技术分享，您的支持将鼓励我继续创作！</div>
    <button id="rewardButton" disable="enable" onclick="var qr = document.getElementById('QR'); if (qr.style.display === 'none') {qr.style.display='block';} else {qr.style.display='none'}">
      <span>赏</span>
    </button>
    <div id="QR" style="display: none;">
      
        <div id="wechat" style="display: inline-block">
          <img id="wechat_qr" src="/uploads/wechat.png" alt="罗天翔 WeChat Pay"/>
          <p>微信打赏</p>
        </div>
      
      
        <div id="alipay" style="display: inline-block">
          <img id="alipay_qr" src="/uploads/ali.jpg" alt="罗天翔 Alipay"/>
          <p>支付宝打赏</p>
        </div>
      
    </div>
  </div>


      
    </div>

    <div>
      
        

      
    </div>

    <footer class="post-footer">
      

      
      
      

      
        <div class="post-nav">
          <div class="post-nav-next post-nav-item">
            
              <a href="/2017/07/14/learn/秒杀系统/" rel="next" title="秒杀系统">
                <i class="fa fa-chevron-left"></i> 秒杀系统
              </a>
            
          </div>

          <span class="post-nav-divider"></span>

          <div class="post-nav-prev post-nav-item">
            
              <a href="/2017/07/14/easytalk/e2/" rel="prev" title="技术问答3">
                技术问答3 <i class="fa fa-chevron-right"></i>
              </a>
            
          </div>
        </div>
      

      
      
    </footer>
  </article>



    <div class="post-spread">
      
    </div>
  </div>


          </div>
          


          
  <div class="comments" id="comments">
    
      <div id="SOHUCS"></div>
    
  </div>


        </div>
        
          
  
  <div class="sidebar-toggle">
    <div class="sidebar-toggle-line-wrap">
      <span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
    </div>
  </div>

  <aside id="sidebar" class="sidebar">
    <div class="sidebar-inner">

      

      
        <ul class="sidebar-nav motion-element">
          <li class="sidebar-nav-toc sidebar-nav-active" data-target="post-toc-wrap" >
            文章目录
          </li>
          <li class="sidebar-nav-overview" data-target="site-overview">
            站点概览
          </li>
        </ul>
      

      <section class="site-overview sidebar-panel">
        <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
          <img class="site-author-image" itemprop="image"
               src="/uploads/avatar.jpg"
               alt="罗天翔" />
          <p class="site-author-name" itemprop="name">罗天翔</p>
           
              <p class="site-description motion-element" itemprop="description">一次就把事情做对.</p>
          
        </div>
        <nav class="site-state motion-element">

          
            <div class="site-state-item site-state-posts">
              <a href="/archives/">
                <span class="site-state-item-count">74</span>
                <span class="site-state-item-name">日志</span>
              </a>
            </div>
          

          
            
            
            <div class="site-state-item site-state-categories">
              <a href="/categories/index.html">
                <span class="site-state-item-count">15</span>
                <span class="site-state-item-name">分类</span>
              </a>
            </div>
          

          

        </nav>

        

        <div class="links-of-author motion-element">
          
            
              <span class="links-of-author-item">
                <a href="https://github.com/louiegit/" target="_blank" title="GitHub">
                  
                    <i class="fa fa-fw fa-github"></i>
                  
                  GitHub
                </a>
              </span>
            
              <span class="links-of-author-item">
                <a href="" target="_blank" title="微信">
                  
                    <i class="fa fa-fw fa-wechat"></i>
                  
                  微信
                </a>
              </span>
            
          
        </div>

        
        

        
        

        


      </section>

      
      <!--noindex-->
        <section class="post-toc-wrap motion-element sidebar-panel sidebar-panel-active">
          <div class="post-toc">

            
              
            

            
              <div class="post-toc-content"><ol class="nav"><li class="nav-item nav-level-3"><a class="nav-link" href="#什么是rocketmq"><span class="nav-number">1.</span> <span class="nav-text">什么是rocketmq:</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#Consumer"><span class="nav-number">1.1.</span> <span class="nav-text">Consumer:</span></a></li></ol></li><li class="nav-item nav-level-3"><a class="nav-link" href="#为什么学习rocketmq"><span class="nav-number">2.</span> <span class="nav-text">为什么学习rocketmq:</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#大体结构"><span class="nav-number">3.</span> <span class="nav-text">大体结构:</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#基本概念"><span class="nav-number">4.</span> <span class="nav-text">基本概念:</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#RocketMQ构成"><span class="nav-number">5.</span> <span class="nav-text">RocketMQ构成</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#RocketMQ物理部署结构"><span class="nav-number">6.</span> <span class="nav-text">RocketMQ物理部署结构</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#如何解决消息的顺序和重复消费"><span class="nav-number">6.1.</span> <span class="nav-text">如何解决消息的顺序和重复消费</span></a></li></ol></li><li class="nav-item nav-level-3"><a class="nav-link" href="#rocketmq如何解决事务问题"><span class="nav-number">7.</span> <span class="nav-text">rocketmq如何解决事务问题</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#producer如何发送消息"><span class="nav-number">8.</span> <span class="nav-text">producer如何发送消息</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#消息如何存储"><span class="nav-number">9.</span> <span class="nav-text">消息如何存储</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#RocketMQ-专业术语"><span class="nav-number">10.</span> <span class="nav-text">RocketMQ 专业术语</span></a></li></ol></div>
            

          </div>
        </section>
      <!--/noindex-->
      

      

    </div>
  </aside>


        
      </div>
    </main>

    <footer id="footer" class="footer">
      <div class="footer-inner">
        <div class="copyright" >
  
  &copy; 
  <span itemprop="copyrightYear">2018</span>
  <span class="with-love">
    <i class="fa fa-heart"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">罗天翔</span>
</div>


<div class="powered-by">
  NBA & Code. What?
</div>

<div class="theme-info">
  主题 -
  <a class="theme-link" href="https://github.com/iissnan/hexo-theme-next">
    NexT.Pisces
  </a>
</div>


        

        
      </div>
    </footer>

    
      <div class="back-to-top">
        <i class="fa fa-arrow-up"></i>
        
      </div>
    

  </div>

  

<script type="text/javascript">
  if (Object.prototype.toString.call(window.Promise) !== '[object Function]') {
    window.Promise = null;
  }
</script>









  












  
  <script type="text/javascript" src="/lib/jquery/index.js?v=2.1.3"></script>

  
  <script type="text/javascript" src="/lib/fastclick/lib/fastclick.min.js?v=1.0.6"></script>

  
  <script type="text/javascript" src="/lib/jquery_lazyload/jquery.lazyload.js?v=1.9.7"></script>

  
  <script type="text/javascript" src="/lib/velocity/velocity.min.js?v=1.2.1"></script>

  
  <script type="text/javascript" src="/lib/velocity/velocity.ui.min.js?v=1.2.1"></script>

  
  <script type="text/javascript" src="/lib/fancybox/source/jquery.fancybox.pack.js?v=2.1.5"></script>


  


  <script type="text/javascript" src="/js/src/utils.js?v=5.1.1"></script>

  <script type="text/javascript" src="/js/src/motion.js?v=5.1.1"></script>



  
  


  <script type="text/javascript" src="/js/src/affix.js?v=5.1.1"></script>

  <script type="text/javascript" src="/js/src/schemes/pisces.js?v=5.1.1"></script>



  
  <script type="text/javascript" src="/js/src/scrollspy.js?v=5.1.1"></script>
<script type="text/javascript" src="/js/src/post-details.js?v=5.1.1"></script>



  


  <script type="text/javascript" src="/js/src/bootstrap.js?v=5.1.1"></script>



  


  




	





  





  





  




  
    <script type="text/javascript">
    (function(){
      var appid = 'cyt9ceIwz';
      var conf = 'c6226e2bfb7e9c65efc235736edc5074';
      var width = window.innerWidth || document.documentElement.clientWidth;
      if (width < 960) {
      window.document.write('<script id="changyan_mobile_js" charset="utf-8" type="text/javascript" src="https://changyan.sohu.com/upload/mobile/wap-js/changyan_mobile.js?client_id=' + appid + '&conf=' + conf + '"><\/script>'); } else { var loadJs=function(d,a){var c=document.getElementsByTagName("head")[0]||document.head||document.documentElement;var b=document.createElement("script");b.setAttribute("type","text/javascript");b.setAttribute("charset","UTF-8");b.setAttribute("src",d);if(typeof a==="function"){if(window.attachEvent){b.onreadystatechange=function(){var e=b.readyState;if(e==="loaded"||e==="complete"){b.onreadystatechange=null;a()}}}else{b.onload=a}}c.appendChild(b)};loadJs("https://changyan.sohu.com/upload/changyan.js",function(){
        window.changyan.api.config({appid:appid,conf:conf})});
      }
    })();
    </script>
    <script type="text/javascript" src="https://assets.changyan.sohu.com/upload/plugins/plugins.count.js"></script>
  




  





  

  

  

  

  

  

</body>
</html>
